package com.jrx.anytxn.reporting.config;

import com.jrx.anytxn.common.uitl.DateUtils;

import java.util.Date;

public class DefaultConfig {
    /**
     * 提交数量
     */
    private Integer chunkLimit = 100;

    /**
     * 异常跳过数量
     */
    private Integer skipLimit = 0;

    /**
     * 线程数
     */
    private Integer throttleLimit = 1;

    /**
     * 指定重跑日期
     */
    private String today;

    @Override
    public String toString() {
        return "DefaultConfig{" +
                "chunkLimit=" + chunkLimit +
                ", skipLimit=" + skipLimit +
                ", throttleLimit=" + throttleLimit +
                ", today='" + today + '\'' +
                ", pageSize=" + pageSize +
                '}';
    }

    /**
     * pagingitemReader一次查询数量
     */
    private Integer pageSize = 10000;

    public DefaultConfig() {
    }

    public DefaultConfig(Integer chunkLimit, Integer skipLimit, Integer throttleLimit, Integer pageSize) {
        this.chunkLimit = chunkLimit;
        this.skipLimit = skipLimit;
        this.throttleLimit = throttleLimit;
        this.pageSize = pageSize;
    }

    public Integer getChunkLimit() {
        return chunkLimit;
    }

    public void setChunkLimit(Integer chunkLimit) {
        this.chunkLimit = chunkLimit;
    }

    public Integer getSkipLimit() {
        return skipLimit;
    }

    public void setSkipLimit(Integer skipLimit) {
        this.skipLimit = skipLimit;
    }

    public Integer getThrottleLimit() {
        return throttleLimit;
    }

    public void setThrottleLimit(Integer throttleLimit) {
        this.throttleLimit = throttleLimit;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    /**
     * 获取 指定重跑日期
     *
     * @return today 指定重跑日期
     */
    public Date getToday() {
        return DateUtils.parseDate(this.today, DateUtils.DATE_PATTERN_ANOTHER);
    }

    /**
     * 设置 指定重跑日期
     *
     * @param today 指定重跑日期
     */
    public void setToday(String today) {
        this.today = today;
    }
}
